<?php
    use mdm\admin\components\MenuHelper;
    use dmstr\widgets\Menu;
?>
<aside class="main-sidebar">

    <section class="sidebar">

        
        
        <!-- Sidebar user panel -->
        <div class="user-panel">
            <div class="pull-left image">
                <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle" alt="User Image"/>
            </div>
            <div class="pull-left info">
                <p><?php
                    if(Yii::$app->user->id > 0){
                        
                        
                    
                    $user = Yii::$app->runAction('user/get-user-info', ['id'=>  Yii::$app->user->id]);
                    
                    echo $user->username;
                    }else{
                        echo '游客';
                    }
                    ?></p>

                <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
            </div>
        </div>
        
        
        <!-- search form -->
        <form action="#" method="get" class="sidebar-form">
            <div class="input-group">
                <input type="text" name="q" class="form-control" placeholder="Search..."/>
              <span class="input-group-btn">
                <button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i>
                </button>
              </span>
            </div>
        </form>
        <!-- /.search form -->

        <?php
           //添加图标
            $items = MenuHelper::getAssignedMenu(Yii::$app->user->id);
            
            $model = new backend\models\Menu();
            
            $items = $model->getMenuIcon($items);
           
            echo Menu::widget([
                'options' => ['class' => 'sidebar-menu'],
                'items' => $items,
            ]);
        ?>
        
    </section>

</aside>
